import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'lib-flexible'
import jsCookie from 'js-cookie'
import * as config from '../config/index.js';
import axios from 'axios';
import * as http from '../api/http.js'

Vue.prototype.$cookie = jsCookie;
Vue.prototype.http = http;
Vue.prototype.$config = config;
Vue.config.productionTip = false

router.beforeEach((to, from, next) => { 
  const openid = jsCookie.get('openid');
  if (!openid && to.path != '/login') {
    jsCookie.set('myUrl', to.fullPath);
    if(to.path == '/login'){
      next()
    } else {
      next('/login');
    }
    return
  } else {
    next()
  }
  // next();
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
